from app.models import SQLBaseModel
from sqlmodel import Field, SQLModel


class BaseFile(SQLModel):
    name: str = Field(index=True, description="文件名")
    save_name: str = Field(description="保存名称")
    extension: str = Field(index=True, description="文件扩展名")
    type: str = Field(index=True, description="文件类型")
    dir: str = Field(description="文件保存目录")
    size: int = Field(description="文件大小")
    size_format: str = Field(description="文件大小格式")
    url: str = Field(description="文件地址")
    md5: str = Field(index=True, description="文件md5")


class File(SQLBaseModel, BaseFile, table=True):
    __tablename__ = "file"
